package Model
{
	import Controller.QualityController;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	[Bindable]
	public class Quality extends EventDispatcher
	{
		private var _airtightnessRate:Number;
		private var _thermalBridgeFree:Boolean;
		private var _propertyChangedEvent:Event = new Event("changedProperty");
		private var qualityController:QualityController = new QualityController();
		
		public function Quality()
		{
			this.airtightnessRate = 0;
			this.thermalBridgeFree = false;
			
			this.addEventListener("changedProperty", handleChange);
		}

		public function get airtightnessRate():Number
		{
			return _airtightnessRate;
		}

		public function set airtightnessRate(value:Number):void
		{
			_airtightnessRate = value;
			dispatchEvent(this._propertyChangedEvent); 
		}

		public function get thermalBridgeFree():Boolean
		{
			return _thermalBridgeFree;
		}

		public function set thermalBridgeFree(value:Boolean):void
		{
			_thermalBridgeFree = value;
			dispatchEvent(this._propertyChangedEvent); 
			
		}

		protected function handleChange(event:Event):void
		{
			this.qualityController.updateQualityStatus();
		}
		
	}
}